package com.thinksns.sociax.t4.model;

import com.thinksns.sociax.thinksnsbase.bean.SociaxItem;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LeiYan
 * @describe 认证分组
 * @date 2017/7/21
 * @contact email:907238552@qq.com
 */

public class VerifyModel extends SociaxItem {
    private String verify_id;
    private String title;

    private List<VerifyModel> child = new ArrayList<>(); // 认证分类项


    public VerifyModel() {
    }

    @Override
    public boolean checkValid() {
        return false;
    }

    @Override
    public String getUserface() {
        return null;
    }

    public VerifyModel(JSONObject object) {
        if (object == null) return;
        if (object.has("verify_id")) {
            setVerify_id(object.optString("verify_id"));
        }
        if (object.has("title")) {
            setTitle(object.optString("title"));
        }
        if (object.has("child") && !object.isNull("child")){
            JSONArray array = object.optJSONArray("child");
            int length = array.length();
            if (length == 0) return;
            VerifyModel model = null;
            for (int i = 0; i < length; i++){
                model = new VerifyModel(array.optJSONObject(i));
                child.add(model);
            }
        }
    }

    public String getVerify_id() {
        return verify_id;
    }

    public void setVerify_id(String verify_id) {
        this.verify_id = verify_id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public List<VerifyModel> getChild() {
        return child;
    }

    public void setChild(List<VerifyModel> child) {
        this.child = child;
    }
}
